package com.newtouch.bxzs.business.product.controller;

import com.newtouch.bxzs.business.config.MyLog;
import com.newtouch.bxzs.business.product.model.AdditionalListBO;
import com.newtouch.bxzs.business.product.service.AdditionalService;
import com.newtouch.bxzs.common.base.response.BaseResponse;
import com.newtouch.bxzs.common.base.response.RespGenerator;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 附加险的controller类
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/1/13 13:41</td>
 * <td>lanwei</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author lanwei
 * @version 1.0.0
 * @since 1.0.0
 */
@Api(tags = "附加险管理")
@RestController
@SuppressWarnings("unchecked")
@RequestMapping("/additionalController")
public class AdditionalController {
    /**
     * 静态变量：系统日志
     */
    private static final Log logger = LogFactory.getLog(ProductController.class);

    @Resource
    private AdditionalService additionalService;

    @ApiOperation(value = "查询附加险列表")
    @GetMapping("/getAdditionalList")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "additionalInsuranceName", value = "附加险名称", paramType = "String"),
            @ApiImplicitParam(name = "mainInsuranceCode", value = "主险种代码", paramType = "String")
    })
    @MyLog(systemFunctionName = "附加险管理", systemFunctionUrl = "/additionalController/getAdditionalList", userOperationType = 4, userOperationSummary = "查询附加险列表")
    public BaseResponse<AdditionalListBO> getAdditionalList(@RequestParam(value = "additionalInsuranceName") String additionalInsuranceName, @RequestParam(value = "mainInsuranceCode") String mainInsuranceCode) {
        logger.info("查询附加险列表");
        return RespGenerator.returnOK(additionalService.getAdditionalList(additionalInsuranceName, mainInsuranceCode));
    }

}
